home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / PRGMMING / CNVLIBD.ZIP / PWD2.BAT < prev    next >
Encoding:
DOS Batch File  |  1993-06-21  |  1.1 KB  |  42 lines

  1. @echo off
  2. REM ********************************************************************
  3. REM *** Pwd - Show the name of current directory                     ***
  4. REM *** this could be done simply by  puts(FullPath(".")) but I      ***
  5. REM *** wanted to test how to use BIOS interrupts with CEnvi         ***
  6. REM Jouni Miettunen * jon@stekt.oulu.fi * Oulu * Finland * Europe * 1993
  7. REM ********************************************************************
  8. @CEnvi %0.bat %1
  9. GOTO CENVI_EXIT
  10.  
  11. main(argc,argv)
  12. {
  13.    if ( argc != 1 )
  14.       Instructions();
  15.    else
  16.       get_cwd()
  17. }
  18.  
  19. get_cwd()
  20. {
  21.    // reserve 200 bytes long buffer
  22.    BLObSize(buffer,200);
  23.    regs.ah = 0x47;
  24.    regs.dl = 0;               // 0 for default
  25.    regs.si = offset(buffer);
  26.    regs.ds = segment(buffer);
  27.    interrupt(0x21,regs);      //get path
  28.    regs.ah = 0x19;
  29.    interrupt(0x21,regs);      //get drive
  30.    printf("%c:\\%s\n",regs.al+'a',strlwr(buffer));
  31. }
  32.  
  33. Instructions()
  34. {
  35.    puts("");
  36.    puts("pwd - Print Working Directory");
  37.    puts("");
  38.    puts("Usage: pwd");
  39. }
  40.  
  41. :CENVI_EXIT
  42.